﻿#ifndef PST_GRAPH3D_H
#define PST_GRAPH3D_H

#include <QWidget>
#include <QHash>
#include <QVector>
#include <QList>
#include "vtkSmartPointer.h"
#include "FieldGraphGenerator.h"

class vtkProp;
class vtkActor;
class vtkAxesActor;
class vtkRenderer;
class vtkRenderWindow;
class QVTKOpenGLNativeWidget;
class vtkRenderWindowInteractor;
class vtkOrientationMarkerWidget;
class vtkGenericOpenGLRenderWindow;


namespace pst
{
    class Graph3DSettings;
    class FieldGraphGenerator;
    struct InfomationGraph3DBasical;

    class Graph3D :public QWidget
    {
        Q_OBJECT

    public:
        explicit Graph3D(QWidget* parent = 0);
        ~Graph3D();


        void addGraph3D(InfomationGraph3DBasical& info);
        bool saveScreenShot(const QString& path);

        void addProp(QList<vtkProp*> props);
    public slots:
        void slot_scalarBarTitleChanged(const QString& title);
        // 修改字体
        void slot_scalarBarFontTypeChanged(QString fontType);
        void slot_scalarBarFontSizeChanged(int fontSize);
        void slot_scalarBarMinValueChanged(double minValue);
        void slot_scalarBarMaxValueChanged(double maxValue);

    private:
        void AddCornerAxes();
        void initConnections();

    private:

        QVTKOpenGLNativeWidget* m_qvtkWidget;
        vtkSmartPointer<vtkActor> m_dataActor;
        //vtkSmartPointer<vtkGenericOpenGLRenderWindow> m_renderWindow3D;
        vtkSmartPointer<vtkRenderWindow> m_renderWindow3D;
        vtkSmartPointer<vtkRenderWindowInteractor> m_interactor;
        vtkSmartPointer<vtkRenderer> m_render3D;
        vtkSmartPointer<vtkAxesActor> m_leftDownCornerAxes;
        vtkSmartPointer<vtkOrientationMarkerWidget> m_leftDownCornerWidget;

        QList<FieldGraphGenerator*> m_fieldGraphGeneratorList;

        QHash<InfomationGraph3DBasical, FieldGraphGenerator*> m_dataMap;

        QVector<pst::FieldGraphGenerator::ArrayInformation> m_allScalarFieldArray;
        QVector<pst::FieldGraphGenerator::ArrayInformation> m_allVectorFieldArray;

        Graph3DSettings* m_settings;

        //目前只允许添加一个三维图
        FieldGraphGenerator* m_currentFieldGraphGenerator;
    };
}

#endif
